package YOONA;

import javax.servlet.GenericServlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.annotation.WebServlet;

@WebServlet("/B")
public class B extends GenericServlet {
    public void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws javax.servlet.ServletException, java.io.IOException {
        ServletConfig servletConfig = this.getServletConfig();
//        System.out.println(servletConfig);
        //方式一获取servletcontext
        ServletContext application = servletConfig.getServletContext();
        System.out.println(application);
        //方式二获取servletcontext  （必须继承了genericservlet）
        ServletContext servletContext = this.getServletContext();
        System.out.println(servletContext);
    }
}
